Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ticket 16304 -- Add HTML5 placeholder attribute support to form fields #1111

Closed
wants to merge 2 commits into from

Conversation

jgasteiz
Copy link

As discussed in #16304, the addition of placeholders to input boxes should be easier than this:

comment = forms.CharField(max_length=200, widget=forms.TextInput({ "placeholder": "Text!"}))

With this change, it will be something like this:

comment = forms.CharField(max_length=200, placeholder="Text!")

Tests done and docs updated.

@@ -318,13 +318,15 @@ For each field, we describe the default widget used if you don't specify
Otherwise, all inputs are valid.
* Error message keys: ``required``, ``max_length``, ``min_length``

Has two optional arguments for validation:
Has three optional arguments for validation:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, placeholder is not meant for use in validation in any way.

@lqc
Copy link

lqc commented May 18, 2013

While generally I think adding this attribute to form fields is not the best idea, if you do it, it should be consistent. As placeholder is a perfectly valid attribute for <input type='datetime'>, why only CharField has the privilege of having it ?

@jgasteiz
Copy link
Author

Another option could be adding this argument to the Field class and all the HTML elements which could take advantage of this attribute would show it (basically, all the inputs except for radio and checkboxes + textareas).

Do you think it's a good approach?

@timgraham
Copy link
Member

Ticket has been marked as won't fix in lieu of a different approach.

@timgraham timgraham closed this May 31, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants